package com.mars.app.base;

import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * Created by pengshuo on 2018/1/3 17:20
 * Description:
 * Modified By:
 * Version:
 *
 * @author pengshuo
 */
@Data
@NoArgsConstructor
public class CommResponse<T> implements Serializable{

    public static final int SUCCESS = 0;
    public static final int FAIL = 1;
    public static final int NO_PERMISSION = 2;

    private String msg = "success";
    private int code = SUCCESS;

    private T data;

    public CommResponse(T data) {
        this.data = data;
    }

    public CommResponse(Throwable e) {
        this.msg = e.toString();
        this.code = FAIL ;
    }

}
